package severlet;

import bean.Laterecord;
import dao.LaterecordDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet(name = "AdminLaterecordServlet", value = "/AdminLaterecordServlet")
public class AdminLaterecordServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");

        //调用dao层
        LaterecordDao laterecordDao=new LaterecordDao();
        //查询所有学生
        ArrayList<Laterecord> allLaterecord = laterecordDao.getAllLaterecord();
        //存入session用于查询
        request.getSession().setAttribute("adminLaterecord",allLaterecord);
        //跳转
        request.getRequestDispatcher("admin_laterecord.jsp").forward(request,response);
    }
}
